﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace TwitterChat
{
	[ServiceContract]
	public interface ITwitterService
	{
        [OperationContract]
        [WebInvoke(Method = "GET", UriTemplate = "Chanels/all")]
        IEnumerable<ChanelDTO> GetAllChanels();

        [OperationContract]
        [WebInvoke(Method = "POST", UriTemplate = "ShowMessages")]
        IEnumerable<MessageDTO> GetMessages(MessagesContactor contractor);

        [OperationContract]
        [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare,
           RequestFormat = WebMessageFormat.Json,
           UriTemplate = "ResetChanel")]
        void CreateChanel(ChanelDTO chanelToReset);

        [OperationContract]
        [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare,
           RequestFormat = WebMessageFormat.Json,
           UriTemplate = "PostMessage")]
        void PostMessage(MessageDTO message);
	}

    [DataContract]
    public class MessagesContactor
    {
        [DataMember]
        public int ChannelId { get; set; }
        [DataMember]
        public int NumberOfMessagesToBeShown { get; set; }
    }
}
